package org.javaboy.order.controller;

import io.seata.rm.tcc.api.BusinessActionContext;
import org.javaboy.api.OrderServiceApi;
import org.javaboy.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class OrderController implements OrderServiceApi {

    @Autowired
    OrderService orderService;

    @Override
    public boolean createOrder(BusinessActionContext actionContext, Integer userId, Integer commodityId, Integer count) {
        return orderService.createOrder(actionContext,userId, commodityId, count);
    }

    @Override
    public boolean commit(BusinessActionContext actionContext) {
        return orderService.commit(actionContext);
    }

    @Override
    public boolean rollback(BusinessActionContext actionContext) {
        return orderService.rollback(actionContext);
    }
}
